package dao_Impl;

import interfaces.DALException;

import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;

import dto_objects.BookDTO;
import dto_objects.FakturaDTO;

public class TST_Jonathan {
	public static void main(String[] args) {
		try {
			new connector.Connector();
		} catch (InstantiationException | IllegalAccessException
				| ClassNotFoundException | SQLException e) {
			e.printStackTrace();
		}

		MySQLBookDAO bookDAO = new MySQLBookDAO();
		MySQLFakturaDAO fakturaDAO = new MySQLFakturaDAO();
		
		BookDTO book = null;
		FakturaDTO fakturaDTO = null;
		try {
			book = bookDAO.getBook_CopyByID(4);
			System.out.println(fakturaDAO.getNewestFakID());
		} catch (DALException | SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		System.out.println(book.getTitle());
		System.out.println(book.getStatus());
		
		
		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		Calendar cal = Calendar.getInstance();
		System.out.println(dateFormat.format(cal.getTime()));
		
		Calendar calDue = Calendar.getInstance();
		calDue.add(Calendar.DATE, 20);
		System.out.println(dateFormat.format(calDue.getTime()));
		
		
//		FakturaDTO fak = new FakturaDTO(7, 8, "Test", "Test");
//		try {
//			fakturaDAO.createFaktura(fak);
//		} catch (DALException e) {
//			e.printStackTrace();
//		}
	}	
}
